package org.zfes.snowier.cloud.zbss.pmp.router.service.pub;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.cloud.zbss.pmp.model.PmpProjectVersion;
import org.zfes.snowier.cloud.zbss.pmp.service.IPmpProjectVersionService;
import org.zfes.snowier.core.data.ComboboVo;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@Controller("org.zfes.snowier.cloud.zbss.pmp.router.service.pub.PmpProjectVersionController")
@RequestMapping("/pmp/service/pub/pmpProjectVersion")
public class PmpProjectVersionController extends BaseController {


    @Autowired
    private IPmpProjectVersionService projectVersionService;
    
    
    @RequestMapping(value="/loadVersionDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadVersionDataSet(@RequestParam Map<String,Object> params){
        DataSet dataSet=  projectVersionService.loadPmpProjectVersionDataSet(params);
        return ajaxQuery("dataSet", dataSet);
    }
    
    @RequestMapping(value="/loadVersionComoboVo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadVersionComoboVo(Long projectId,Boolean firstEmpty){
    	List<ComboboVo> vo=  projectVersionService.loadVersionComoboVo(projectId,firstEmpty);
    	return ajaxQuery("comboboVo", vo);
    }
    
    @RequestMapping(value="/loadVersion", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadVersion(Long id){
    	 Optional<PmpProjectVersion>  version=  projectVersionService.loadPmpProjectVersionById(id);
    	return ajaxQuery("version", version);
    }



}
